// 发布页面
import request from '../request/request';

// 上传文件
export const uploadFile = (file, userId) => {
  const formData = new FormData();
  formData.append('file', file);
  
  return request({
    url: '/File/file',
    method: 'post',
    data: formData,
    headers: {
      'id': userId,
      'Content-Type': 'multipart/form-data' // 覆盖基础headers中的Content-Type
    }
  });
};

// 发布攻略
export const addStrategy = (data) => {
  return request({
    url: '/Intro/add',
    method: 'post',
    data,
    headers: {
      'id': data.user_id
    }
  });
};
// 发布游记
export const addTravel = (data) => {
  return request({
    url: '/Travels/add',
    method: 'post',
    data,
    headers: {
      'id': data.user_id
    }
  });
};
// 发布问答
export const addQuestion = (data) => {
  return request({
    url: '/Queans/add',
    method: 'post',
    data,
    headers: {
      'id': data.user_id
    }
  });
};